package CoreClass;

import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
//        String s1 = "hello world";
//        String s2 = "hello world";
//        System.out.println(s);
//        s = s.toUpperCase();
//        System.out.println(s);
//        System.out.println(s1 == s2);
//        System.out.println(s1.equals(s2));
//        System.out.print(s1.indent(5));
//        System.out.println(s1.indexOf("l"));
//        System.out.println(s1.indexOf("l", 3));
//        System.out.println(s1.lastIndexOf("l"));
//        System.out.println(s1.startsWith("he"));
//        System.out.println(s1.endsWith("ld"));
//        String s = "  \t hello\r\n ".trim();//去掉字符串首尾的空格 isBlank()和isEmpty()
//        System.out.println(String.valueOf(123));
//        System.out.println(String.valueOf(45.67));
//        System.out.println(String.valueOf(true));
//        System.out.println(String.valueOf(new Object()));
//        int[] scores = {80, 90, 100};
//        Score score = new Score(scores);
//        score.printScores();
//        scores[1] = 95;
//        score.printScores();
//        Integer i = 10;
//        i = 20;
//        System.out.println(i);
//        int x = Integer.parseInt("123",16);
//        System.out.println(x);
//        Point p = Point.of(1, 2);
//        String[] s = {"args"};
//        Point.main(s);
    }
}

class Score {
    private final int[] scores;

    public Score(int[] scores) {
        this.scores = scores.clone();
    }

    public void printScores() {
        System.out.println(Arrays.toString(scores));
    }
}

record Point(int x, int y) {
    public static void main(String[] args) {
        Point p = new Point(1, 2);
        System.out.println(p);
    }
    public Point{
        if(x<0||y<0){
            throw new IllegalArgumentException("坐标不能小于0");
        }
    }
    public static Point of(int x, int y) {
        return new Point(x, y);
    }
}
//Math：数学计算
//HexFormat：格式化十六进制数
//Random：生成伪随机数
//SecureRandom：生成安全的随机数